/**
 * 
 */
package vn.com.demand.lux.preferences;

import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.swtdesigner.FieldLayoutPreferencePage;
import com.swtdesigner.ResourceManager;
import vn.com.demand.lux.Activator;

/**
 * @author Nguyen The Thinh
 *
 */
public class CriteriaPreferencePage extends FieldLayoutPreferencePage implements
		IWorkbenchPreferencePage {

	/**
	 * Create the preference page
	 */
	public CriteriaPreferencePage() {
		super();
		setTitle("Init Criteria  Value");
		setDescription("The value will be set when user open Account Receivable anh Interest Summary");
		setImageDescriptor(ResourceManager.getPluginImageDescriptor(Activator.getDefault(), "icons/actions/dayview.png"));
	}

	/**
	 * Create contents of the preference page
	 * @param parent
	 */
	@Override
	public Control createPageContents(Composite parent) {
		Composite container = new Composite(parent, SWT.NULL);
		final FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
		fillLayout.spacing = 10;
		container.setLayout(fillLayout);

		final Group accountReceivableGroup = new Group(container, SWT.NONE);
		accountReceivableGroup.setText("Account Receivable");
		accountReceivableGroup.setLayout(new FillLayout());

		final Composite composite = new Composite(accountReceivableGroup, SWT.NONE);

		addField(new RadioGroupFieldEditor("", "Useage option", 1, new String[][] {new String[] {"Use default value", ""}, new String[] {"Use lastest value", ""}}, composite));

		final Group interestSummaryGroup = new Group(container, SWT.NONE);
		interestSummaryGroup.setText("Interest Summary");
		interestSummaryGroup.setLayout(new FillLayout());
		return container;
	}

	/**
	 * Initialize the preference page
	 */
	public void init(IWorkbench workbench) {
		// Initialize the preference page
	}

}
